package com.dense.kuiniu.bookborrow.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * @author Administrator
 * @date 2020/7/29
 */
public class InstallReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        //接收安装广播
        if ("android.intent.action.PACKAGE_ADDED".equals(intent.getAction())) {
            String packageName = intent.getDataString();
            if ("package:com.iflytek.speechcloud".equals(packageName)) {
                try {
                    Intent newIntent = new Intent();
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    newIntent.setAction("com.android.settings.TTS_SETTINGS");
                    context.startActivity(newIntent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
